package com.stone.framework.task.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.batch.core.JobExecution;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.stone.framework.message.task.JobExecutionPageReqBody;
import com.stone.framework.message.task.JobExecutionPageResBody;

@Mapper
public interface JobExecutionMapper extends BaseMapper<JobExecution> {

    @Select("SELECT bje.*, bji.JOB_NAME FROM BATCH_JOB_EXECUTION bje JOIN BATCH_JOB_INSTANCE bji ON bje.JOB_INSTANCE_ID = bji.JOB_INSTANCE_ID ${ew.customSqlSegment}")
    IPage<JobExecutionPageResBody> selectPage(Page<JobExecutionPageResBody> page,
        @Param(Constants.WRAPPER) Wrapper<JobExecutionPageReqBody> queryWrapper);

}
